//package cn.net.wanji.config;
//
//import cn.net.wanji.entity.SiteInfo;
//import cn.net.wanji.service.DataReceiveService;
//import cn.net.wanji.utils.StringUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import static cn.net.wanji.config.CommonParamConfig.ENTRY_CODE;
//import static cn.net.wanji.config.CommonParamConfig.EXIT_CODE;
//
///**
// * Created by IntelliJ IDEA.
// * 刷新站点数据定时任务
// *
// * @Author : yangliang
// * @create 2022/11/2 10:16
// */
//@Slf4j(topic = "初始化站点信息配置文件【ServiceConfigJob】")
//@Component
//public class RefreshSignageDataJob {
//
//    @Autowired
//    private DataReceiveService dataReceiveService;
//    public static List<SiteInfo> siteInfoList;
//    public static Map<String, SiteInfo> siteInfoMap = new HashMap<>();
//    public static Map<String, List<String>> serviceInfoMap = new HashMap<>();
//
////    @PostConstruct
//    public void selectData() {
//        siteInfoList = dataReceiveService.listAllSiteInfos(new SiteInfo());
//        for (SiteInfo siteInfo : siteInfoList) {
//            String siteCode = siteInfo.getSiteCode();
//            if (siteInfo.getDirection().equals(EXIT_CODE)) {
//                for (SiteInfo siteInfo2 : siteInfoList) {
//                    if (StringUtils.isEmpty(siteInfo.getBelongService()) || StringUtils.isEmpty(siteInfo2.getBelongService())) {
//                        continue;
//                    }
//                    if (siteInfo2.getDirection().equals(ENTRY_CODE) &&
//                            siteInfo.getBelongService().equals(siteInfo2.getBelongService())) {
//                        if (serviceInfoMap.containsKey(siteCode)) {
//                            List<String> siteCodes = serviceInfoMap.get(siteCode);
//                            siteCodes.add(siteInfo2.getSiteCode());
//                            serviceInfoMap.put(siteCode, siteCodes);
//                        } else {
//                            ArrayList<String> siteCodes = new ArrayList<>();
//                            siteCodes.add(siteInfo2.getSiteCode());
//                            serviceInfoMap.put(siteCode, siteCodes);
//                        }
//                    }
//                }
//            }
//            siteInfoMap.put(siteInfo.getSiteCode(), siteInfo);
//        }
//        System.out.println(serviceInfoMap);
//    }
//
//    public void clearCache() {
//        siteInfoList = null;
//    }
//}
